package com.speed_run.utils;

import com.speed_run.dto.FollowerDTO;
import com.speed_run.dto.UserCircleDTO;
import com.speed_run.vo.StatisInnerVo;

import lombok.Data;

import java.util.List;

@Data
public class ResponseEntity {

    public static final int SUCCESS = 0;

    public static final int FAIL = 1;

    private Object data;

    private String msg;

    private int code;

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public ResponseEntity(String msg, Object data){
        this.msg = msg;
        this.data = data;
    }
    public ResponseEntity(int code , String msg , Object data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ResponseEntity ok(int code, String msg, Object data){
        return new ResponseEntity(code, msg, data);
    }

    public static ResponseEntity ok(String msg){
        return ok(SUCCESS, msg, "");
    }

    public static ResponseEntity ok(String msg, Object data){
        return ok(SUCCESS,msg, data);
    }

    public static ResponseEntity ok1(String msg, List<UserCircleDTO> data){
        return ok(SUCCESS,msg, data);
    }
    
    public static ResponseEntity ok2(String msg, List<FollowerDTO> data){
        return ok(SUCCESS,msg, data);
    }
    
    public static ResponseEntity ok3(String msg, List<StatisInnerVo> data){
        return ok(SUCCESS,msg, data);
    }

    public static ResponseEntity fail(int code, String msg, Object data){
        return new ResponseEntity(FAIL, msg, data);
    }


    public static ResponseEntity fail(String msg){
        return fail(FAIL, msg, "");
    }

    public static ResponseEntity fail(String msg, Object data){
        return fail(FAIL, msg, data);
    }

    public static ResponseEntity fail(){
        return fail(FAIL, "", "");
    }

}
